
import { useSearchParams } from 'react-router-dom';
// 当前路径为 /foo?id=12
export default function (){
  const [searchParams, setSearchParams] = useSearchParams();
    console.log(searchParams.get('id')) // 12
    setSearchParams({
        id: '24'
    }) // /foo?name=foo
    return (
        <div>SearchParams({searchParams.get('id')})</div>
    )
} 